//============================================================================
// Name        : faz-broker.cpp
// Author      : Christian Barth
// Version     :
// Copyright   : MIT
// Description : console main of the faz-broker
//============================================================================

#include <cstdlib>

#include <iostream>
#include <iomanip>
#include <string>

#include "Stock.h"
#include "IDataInput.h"
#include "HttpDataInput.h"

using namespace faz_broker;

int
main(int argc, char** argv)
{
  std::cout << setw (50) << "F A Z  -  B R O K E R" << std::endl << std::endl;

  if (argc < 3)
  {
    std::cerr << "Usage: " << argv[0] << " Username Password" << std::endl;
    return EXIT_FAILURE;
  }

  std::string usr (argv[1]);
  std::string pwd (argv[2]);

  IDataInput *di = new HttpDataInput(usr, pwd);

  Stock st = di->GetStock("Test Stock abc");
  std::cout << setw(10) << "name: " << st.GetName() << std::endl
            << setw(10) << "count: " << st.GetCount() << std::endl
            << setw(10) << "start: " << st.GetStartValue() << std::endl
            << setw(10) << "current: " << st.GetCurrentValue() << std::endl;

  delete di;
  return EXIT_SUCCESS;
}
